package jrain.fw.core.boot;

import java.util.Map;

/**
 * <pre>
 * 作者：489088214@qq.com 
 * 描述：框架启动类
 * </pre>
 */
public class JRainMain {

	private static boolean running = true;

	public static void main(String[] args) {
		start(null);
	}

	public static void start(Map<String, Object> prop) {
		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				synchronized (JRainMain.class) {
					Launcher.stop();
					JRainMain.class.notify();
					running = false;
				}
			}
		});
		Launcher.start(prop);
		synchronized (JRainMain.class) {
			while (running) {
				try {
					JRainMain.class.wait();
				} catch (Throwable e) {
					e.printStackTrace();
				}
			}
		}
	}

}